package com.easy.frame.message.send;

import com.easy.frame.message.entity.SendTemplateDto;
import com.easy.frame.message.entity.StaffReceive;
import com.easy.frame.message.msg.IMessage;
import lombok.extern.slf4j.Slf4j;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;

/**
 * @author 86131
 */
@Slf4j
public class EMSSend implements IMessage {

    @Override
    public void send(SendTemplateDto<StaffReceive> sendTemplateDto, List<StaffReceive> users) {

    }

    public static String md5(String content) {
        String res = "";
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(content.getBytes());
            byte[] digest = md.digest();
            int i;
            StringBuilder buf = new StringBuilder("");
            for (byte b : digest) {
                i = b;
                if (i < 0) {
                    i += 256;
                }
                if (i < 16) {
                    buf.append("0");
                }
                buf.append(Integer.toHexString(i));
            }
            res = buf.toString();

        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return res;
    }
}
